<%@page import="constant.Constant"%>
<%@page import="net.smartam.leeloo.common.OAuth"%>
<%@ page language="java" contentType="text/html; charset=ISO-8859-1"
    pageEncoding="ISO-8859-1"%>
<!DOCTYPE html PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN" "http://www.w3.org/TR/html4/loose.dtd">
<html>
<head>
<meta http-equiv="Content-Type" content="text/html; charset=ISO-8859-1">
<title>Please login</title>
<link rel="stylesheet" type="text/css" href="css/common.css">
</head>
<body>


<%
/* 	String post_url = null;//request.getParameter(Constant.SYNC_REDIRECT_URI);
	if(post_url==null)
		post_url = Constant.DEFAULT_URL_AUTHSERVER; */
	String post_url = request.getRequestURL().substring(0, request.getRequestURL().indexOf(request.getRequestURI()))
		+Constant.DEFAULT_URL_AUTHSERVER;
		
	String ap = request.getParameter(Constant.SYNC_AP); 
	String defaultuser = null;
	if(Constant.AP_HP.equals(ap))
		defaultuser = "mike.beiter@hp.com";
	else
		defaultuser = "mike.beiter@other.com";
%>


<form method='post' action='<%=post_url%>?
	&<%=OAuth.OAUTH_REDIRECT_URI%>=<%=request.getParameter(Constant.SYNC_REDIRECT_URI)%>
	&<%=OAuth.OAUTH_RESPONSE_TYPE%>=<%=net.smartam.leeloo.common.message.types.ResponseType.CODE.toString()%>
	'>
	
<table align=center style="margin-top:100px;">
	<tbody>
	<tr>
		<td colspan=2> 
		<p> Please login from EXTERNAL AuthN Point <%=ap%>. </p>
		</td>
	</tr>
	<tr>
		<td colspan=2>
			&nbsp;
		</td>
	</tr>
	<tr>
		<td>
			Please input user &nbsp;&nbsp;
		</td>
		<td>
			<input value='<%=defaultuser%>' size=20 name='<%=Constant.SYNC_USER%>' type=text>
		</td>
	</tr>
	<tr>
		<td>
			Please input password &nbsp;&nbsp;
		</td>
		<td>
			<input value='initial' size=20 name='<%=Constant.SYNC_PASSWORD%>' type=password>
		</td>
	</tr>
	<tr>
		<td colspan=2>
			&nbsp; <input type=hidden name ='<%=Constant.SYNC_AP%>' value ='<%=ap %>'>
			&nbsp; <input type=hidden name ='<%=OAuth.OAUTH_CLIENT_ID%>' value ='<%=request.getParameter(OAuth.OAUTH_CLIENT_ID)%>'>
			&nbsp; <input type=hidden name ='<%=OAuth.OAUTH_CLIENT_SECRET%>' value ='<%=request.getParameter(OAuth.OAUTH_CLIENT_SECRET)%>'>
		</td>
	</tr>	
	<tr>
		<td>	
			<input type=submit value='Login'>
		</td>
	</tr>
	</tbody>
</table>	
</form>
</body>
</html>